package com.example.surveyapplication;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainSettingActivity extends Activity implements OnClickListener{
	Button btnSetting;
	Button btnResult;
	Button btnSittingResult;
	Button btnBack;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main_setting);
		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
		
		initComponents();
	}
	
	private void initComponents() {
		btnSetting = (Button)findViewById(R.id.btnSetting_MainSetting);
		btnResult = (Button)findViewById(R.id.btnResult_MainSetting);
		btnSittingResult = (Button)findViewById(R.id.btnSittingResult_MainSetting);
		btnBack = (Button)findViewById(R.id.btnBack_MainSetting);
		
		btnSetting.setOnClickListener(this);
		btnResult.setOnClickListener(this);
		btnSittingResult.setOnClickListener(this);
		btnBack.setOnClickListener(this);
	}
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
	    if (keyCode == KeyEvent.KEYCODE_BACK) {
	        moveTaskToBack(false);
	        return false;
	    }
	    return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main_setting, menu);
		return true;
	}

	public void onClick(View view) {
		Intent intent;
		
		switch (view.getId()) {
		case R.id.btnSetting_MainSetting:
			intent = new Intent(this, SettingActivity.class);
			startActivity(intent);
			break;
		case R.id.btnResult_MainSetting:
			intent = new Intent(this, ResultActivity.class);
			startActivity(intent);
			break;
		case R.id.btnSittingResult_MainSetting:
			intent = new Intent(this, SittingResultActivity.class);
			startActivity(intent);
			break;
		case R.id.btnBack_MainSetting:
			intent = new Intent(this, PersonalInfoActivity.class);
			startActivity(intent);
			finish();
			break;
		default:
			break;
		}
	}
}
